import React from 'react'
import { Route, Redirect } from 'react-router-dom'
import { isAuth } from '../../utils/auth'
export default function index({ component: Component, ...rest }) {
  return (
    <Route {...rest} render={props => {
      if (isAuth()) {
        return <Component {...props} />
      } else {
        return (
          <Redirect to={{ pathname: '/login', state: { from: props.location } }} />
        )
      }

    }} />


  )
}
